package com.yiqi.lottery.feature.football.view;

import android.content.Intent;
import android.content.res.Resources;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.support.v7.widget.Toolbar;
import android.text.Html;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.ExpandableListView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.suozhang.framework.entity.bo.PageData;
import com.suozhang.framework.framework.BaseActivity;
import com.suozhang.framework.utils.T;
import com.yiqi.lottery.R;
import com.yiqi.lottery.common.util.DataManager;
import com.yiqi.lottery.entity.bo.BallMatchBo;
import com.yiqi.lottery.entity.bo.BallMatchBo2;
import com.yiqi.lottery.feature.football.adapter.FootballMatchAdapter;
import com.yiqi.lottery.feature.football.contract.FootballContract;
import com.yiqi.lottery.feature.football.dependencies.football.DaggerFootballComponent;
import com.yiqi.lottery.feature.football.dependencies.football.FootballPresenterModule;
import com.yiqi.lottery.framework.DataServer;

import java.util.ArrayList;
import java.util.List;

import javax.inject.Inject;

import butterknife.BindView;
import butterknife.OnClick;

public class FootballMatchBetActivity extends BaseActivity implements Toolbar.OnMenuItemClickListener, FootballContract.View {

    @Inject
    FootballContract.Presenter mPresenter;

    @BindView(R.id.view_toolbar)
    RelativeLayout view_toolbar;
    @BindView(R.id.img_back)
    ImageView img_back;
    @BindView(R.id.ll_center)
    LinearLayout ll_center;
    @BindView(R.id.tv_title)
    TextView tv_title;
    @BindView(R.id.img_xiala)
    ImageView img_xiala;
    @BindView(R.id.img_shaixuan)
    ImageView img_shaixuan;
    @BindView(R.id.list_view)
    ExpandableListView list_view;
    @BindView(R.id.img_delete)
    ImageView img_delete;
    @BindView(R.id.tv_selected)
    TextView tv_selected;
    @BindView(R.id.tv_buy)
    TextView tv_buy;
    @BindView(R.id.ll_danguan_top)
    LinearLayout ll_danguan_top;
    @BindView(R.id.ll_danguan_1)
    LinearLayout ll_danguan_1;
    @BindView(R.id.ll_danguan_2)
    LinearLayout ll_danguan_2;
    @BindView(R.id.line_danguan)
    View line_danguan;

    FootballMatchAdapter mAdapter;
    PopupWindow mPopupWindow;
    private int mCurrentBetType;

    private ArrayList<BallMatchBo2> mDanguanData;

    private ArrayList<BallMatchBo> mDataList;

    private ArrayList<String> mMatchFilters;

    @Override
    public boolean onMenuItemClick(MenuItem item) {
        return false;
    }

    @Override
    protected int attachLayoutRes() {
        return R.layout.activity_football_match_bet;
    }

    @Override
    protected void initView() {
        mCurrentBetType = 6;
        tv_title.setText("混合过关");
        initExpandableListView();
    }

    private void initExpandableListView() {
        list_view.setGroupIndicator(null);
        list_view.setAdapter(getAdapter());
    }

    public void onResume() {
        super.onResume();
        getAdapter().notifyDataSetChanged();
    }

    private FootballMatchAdapter getAdapter() {
        if (mAdapter == null) {
            mAdapter = new FootballMatchAdapter(this);
            mAdapter.setOnCheckedNumChangeListener(new FootballMatchAdapter.OnCheckedNumChangeListener() {
                @Override
                public void onCheckedNumChange(int num) {
                    tv_selected.setText(Html.fromHtml("已选<font color=\"#D83220\">" + num + "</font>场"));
                }

                @Override
                public void showPopupWindow(int currentType, BallMatchBo.MatchInfo matchInfo, TextView tv) {
                    if (currentType == 2 || currentType == 4 || currentType == 8) {
                        showSelectDialog(currentType, matchInfo, tv);
                    }
                }
            });
        }
        return mAdapter;
    }

    @Override
    protected void initInjector() {
        DaggerFootballComponent.builder().footballPresenterModule(new FootballPresenterModule(this)).build().inject(this);
    }

    @Override
    protected void initData() {
        getAdapter().setDatas(null, mCurrentBetType);
        tv_selected.setText(Html.fromHtml("已选<font color=\"#D83220\">" + 0 + "</font>场"));
        String label = "";
        switch (mCurrentBetType) {
            case 0://胜负平
                label = "spf";
                break;
            case 1://让球胜负平
                label = "rqspf";
                break;
            case 2://比分
                label = "bf";
                break;
            case 3://总进球
                label = "zjq";
                break;
            case 4://半全场
                label = "bqc";
                break;
            case 5://混头2选1
                label = "htexy";
                break;
            case 6://混合过关
            case 7://单关1
            case 8://单关2
                label = "hhgg";
                break;
        }
        mPresenter.getFootballMatchList(label);
    }

    @OnClick({R.id.img_back, R.id.ll_center, R.id.img_shaixuan, R.id.img_delete,
            R.id.tv_buy, R.id.ll_danguan_1, R.id.ll_danguan_2})
    public void onViewClicked(View view) {
        int id = view.getId();
        switch (id) {
            case R.id.img_back:
                finish();
                break;
            case R.id.ll_center:
                if (mPopupWindow != null) {
                    mPopupWindow.dismiss();
                } else {
                    img_xiala.setRotation(180);
                    initPopupWindowView();
                }
                break;
            case R.id.img_shaixuan:
                List<String> lids = getFilterLids();
                if (lids.isEmpty()) {
                    return;
                }
                ArrayList<MatchFilterActivity.MatchFilter> matchFilters = new ArrayList<>();
                MatchFilterActivity.MatchFilter matchFilter;
                for (String str : lids) {
                    matchFilter = new MatchFilterActivity.MatchFilter();
                    matchFilter.name = str;
                    if (mMatchFilters != null) {
                        matchFilter.isCheck = mMatchFilters.contains(str);
                    }
                    matchFilters.add(matchFilter);
                }
                Intent intent = new Intent(this, MatchFilterActivity.class);
                intent.putExtra("list", matchFilters);
                startActivityForResult(intent, 1001);
                break;
            case R.id.img_delete:
                getAdapter().resetCheck();
                break;
            case R.id.tv_buy:
                List<List<BallMatchBo.MatchInfo>> list = getAdapter().getSelectMatchs();
                if (list == null || list.isEmpty()) {
                    T.showShort("请选择比赛！");
                    return;
                }
//                switch (mCurrentBetType) {
//                    case 0://胜负平
//                    case 1://让球胜负平
//                    case 2://比分
//                    case 3://总进球
//                    case 4://半全场
//                    case 5://混头2选1
//                    case 6://混合过关
//                    case 7://单关1
//                    case 8://单关2
//                }
                if (list.size() == 1 && mCurrentBetType < 7) {
                    if (mCurrentBetType < 6) {
                        BallMatchBo.MatchInfo matchInfo = list.get(0).get(0);
                        if (!matchInfo.isDanguan()) {
                            T.showShort("至少选两场比赛！");
                            return;
                        }
                        if (mCurrentBetType ==4||mCurrentBetType ==2||mCurrentBetType ==3){
                            if (mCurrentBetType>4){
                                T.showShort("半全场，比分或者总进球的时候，不能超过4串1！");
                                return;
                            }
                        }

                    } else {
                        boolean isCanDanguan = true;
                        List<BallMatchBo.MatchInfo> matchInfos = list.get(0);
                        for (BallMatchBo.MatchInfo matchInfo : matchInfos) {
                            if (matchInfo.getPlay().getCheckedNum() > 0 && !matchInfo.isDanguan()) {
                                isCanDanguan = false;
                                break;
                            }
                        }
                        if (!isCanDanguan) {
                            T.showShort("至少选两场比赛！");
                            return;
                        }
                    }
                }

                if (list.size() > 15) {
                    T.showShort("最多只能选15场比赛！");
                    return;
                }

                DataManager.getInstance().setTempObject(list);
                intent = new Intent(this, FootballMatchCalculateMoneyActivity.class);
                intent.putExtra("current_type", mCurrentBetType);
                startActivity(intent);
                break;
            case R.id.ll_danguan_1:
                mCurrentBetType = 7;
                rsetDanguanTop(ll_danguan_1, ll_danguan_2);
                if (mDanguanData == null) {
                    initData();
                    return;
                }
                resetDanguanData((List<BallMatchBo2>) mDanguanData.clone());
                break;
            case R.id.ll_danguan_2:
                mCurrentBetType = 8;
                rsetDanguanTop(ll_danguan_2, ll_danguan_1);
                if (mDanguanData == null) {
                    initData();
                    return;
                }
                resetDanguanData((List<BallMatchBo2>) mDanguanData.clone());
                break;
                default:

        }
    }

    public ArrayList<String> getFilterLids() {
        ArrayList<String> listLids = new ArrayList<>();
        if (mDataList == null || mDataList.isEmpty()) {
            return listLids;
        }
        for (BallMatchBo bo : mDataList) {
            if (bo.getList() != null) {
                List<BallMatchBo.MatchInfo> list = bo.getList();
                for (BallMatchBo.MatchInfo matchInfo : list) {
                    if (!listLids.contains(matchInfo.getLid())) {
                        listLids.add(matchInfo.getLid());
                    }
                }
            } else if (bo.getList1() != null) {
                List<List<BallMatchBo.MatchInfo>> list = bo.getList1();
                for (List<BallMatchBo.MatchInfo> matchInfos : list) {
                    if (!listLids.contains(matchInfos.get(0).getPlay().getLid())) {
                        listLids.add(matchInfos.get(0).getPlay().getLid());
                    }
                }
            }
        }
        return listLids;
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (requestCode == 1001 && resultCode == 1002) {
            mMatchFilters = data.getExtras().getStringArrayList("list");
            if (mMatchFilters != null && !mMatchFilters.isEmpty() && mDataList != null) {
                List<BallMatchBo> dataList = new ArrayList<>();
                BallMatchBo matchBo;
                for (BallMatchBo bo : mDataList) {
                    matchBo = new BallMatchBo();
                    matchBo.setDate(bo.getDate());
                    dataList.add(matchBo);
                    if (bo.getList() != null) {
                        List<BallMatchBo.MatchInfo> list = (List<BallMatchBo.MatchInfo>) ((ArrayList) bo.getList()).clone();
                        matchBo.setList(list);
                        for (int i = 0; i < list.size(); ) {
                            if (!mMatchFilters.contains(list.get(i).getLid())) {
                                list.remove(i);
                                continue;
                            }
                            ++i;
                        }
                    } else if (bo.getList1() != null) {
                        List<List<BallMatchBo.MatchInfo>> list = (List<List<BallMatchBo.MatchInfo>>) ((ArrayList) bo.getList1()).clone();
                        matchBo.setList1(list);
                        for (int i = 0; i < list.size(); ) {
                            if (!mMatchFilters.contains(list.get(i).get(0).getPlay().getLid())) {
                                list.remove(i);
                                continue;
                            }
                            ++i;
                        }
                    }
                }
                getAdapter().setDatas(dataList, mCurrentBetType);
            } else {
                getAdapter().setDatas(mDataList, mCurrentBetType);
            }
        }
    }

    private void rsetDanguanTop(LinearLayout llDanguan1, LinearLayout llDanguan2) {
        llDanguan1.getChildAt(0).setVisibility(View.VISIBLE);
        ((TextView) llDanguan1.getChildAt(1)).setTextColor(getResources().getColor(R.color.color_d8_32_20));
        llDanguan2.getChildAt(0).setVisibility(View.GONE);
        ((TextView) llDanguan2.getChildAt(1)).setTextColor(getResources().getColor(R.color.text_primary));
    }

    public void initPopupWindowView() {
        LinearLayout contentView = (LinearLayout) LayoutInflater.from(this).inflate(R.layout.popup_football_bet_type, null, false);
        mPopupWindow = new PopupWindow(contentView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT, true);
        mPopupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
        mPopupWindow.setOutsideTouchable(true);
        mPopupWindow.setTouchable(true);
        mPopupWindow.showAsDropDown(view_toolbar);
        // 设置背景半透明
        backgroundAlpha(0.7f);

        mPopupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
            @Override
            public void onDismiss() {
                backgroundAlpha(1f);
                img_xiala.setRotation(0);
                mPopupWindow = null;
            }
        });

        contentView.setOnTouchListener(new View.OnTouchListener() {

            @Override
            public boolean onTouch(View v, MotionEvent event) {

                return false;
            }
        });
        resetBtnByCurrentBetType(contentView);
    }


    public void showSelectDialog(int currentBetType, BallMatchBo.MatchInfo matchInfo, TextView tv) {
        final MyDialogFragment dialogFragment = new MyDialogFragment();
        if (currentBetType == 2) {
            dialogFragment.setLayout(R.layout.popup_select_football_bifen);
        } else {
            dialogFragment.setLayout(R.layout.popup_select_football_banquanchang);
        }
        dialogFragment.setOnMyDialogListener(new MyDialogFragment.OnMyDialogListener() {
            @Override
            public void initView(View contentView) {
                ((TextView) contentView.findViewById(R.id.tv_1_1)).setText(Html.fromHtml(matchInfo.getHn()));
                ((TextView) contentView.findViewById(R.id.tv_1_3)).setText(Html.fromHtml(matchInfo.getAn()));
                int peilvIndex = 0;
                if (currentBetType == 2) {
                    peilvIndex = initSelectView(currentBetType, (LinearLayout) ((LinearLayout) contentView.findViewById(R.id.ll_sheng)).getChildAt(1), matchInfo, peilvIndex);
                    peilvIndex = initSelectView(currentBetType, (LinearLayout) ((LinearLayout) contentView.findViewById(R.id.ll_ping)).getChildAt(1), matchInfo, peilvIndex);
                    initSelectView(currentBetType, (LinearLayout) ((LinearLayout) contentView.findViewById(R.id.ll_fu)).getChildAt(1), matchInfo, peilvIndex);
                } else {
                    initSelectView(currentBetType, (LinearLayout) ((LinearLayout) contentView.findViewById(R.id.ll)).getChildAt(1), matchInfo, peilvIndex);
                }
                dialogFragment.setDialogViewsOnClickListener(contentView, R.id.tv_cancel, R.id.tv_ok);
            }

            @Override
            public void onViewClick(int viewId) {
                if (viewId == R.id.tv_ok) {
                    ArrayList<String> list = matchInfo.getSpTypeGg();
                    String[] dataType;
                    if (currentBetType == 2) {
                        dataType = DataServer.FOOT_BALL_BF;
                    } else if (currentBetType == 4) {
                        dataType = DataServer.FOOT_BALL_BQC;
                    } else {
                        dataType = DataServer.FOOT_BALL_BQC;
                    }
                    String text = "";
                    int size = list.size();
                    for (int i = 0; i < size; ++i) {
                        matchInfo.setCheck(i, matchInfo.isTempCheck(i));
                        if (matchInfo.isCheck(i)) {
                            text += dataType[i] + "[" + list.get(i) + "] ";
                        }
                    }
                    if (TextUtils.isEmpty(text)) {
                        tv.setText("点击投注");
                        tv.setTextSize(13);
                        tv.setBackgroundResource(R.drawable.bg_touzhu);
                        tv.setTextColor(getResources().getColor(R.color.text_remind_2));
                    } else {
                        tv.setText(text);
                        tv.setTextSize(10);
                        tv.setBackgroundResource(R.drawable.bg_ok);
                        tv.setTextColor(getResources().getColor(R.color.primary_comparison));
                    }
                    tv_selected.setText(Html.fromHtml("已选<font color=\"#D83220\">" + getAdapter().getCheckNum() + "</font>场"));
                }
            }
        });
        dialogFragment.show(getSupportFragmentManager(), "MyDialogFragment");
    }

    private int initSelectView(int currentBetType, LinearLayout llParent, BallMatchBo.MatchInfo matchInfo, int currentIndex) {

        int childCount = llParent.getChildCount();
        LinearLayout ll, itemView;
        Resources resources = getResources();
        ArrayList<String> list = matchInfo.getSpTypeGg();
        String[] dataType;
        if (currentBetType == 2) {
            dataType = DataServer.FOOT_BALL_BF;
        } else if (currentBetType == 4) {
            dataType = DataServer.FOOT_BALL_BQC;
        } else {
            dataType = DataServer.FOOT_BALL_BQC;
        }
        for (int i = 0; i < childCount; ++i) {
            ll = (LinearLayout) llParent.getChildAt(i);
            for (int j = 0; j < ll.getChildCount(); ++j) {
                matchInfo.setTempCheck(currentIndex, matchInfo.isCheck(currentIndex));
                itemView = (LinearLayout) ll.getChildAt(j);
                itemView.setTag(currentIndex);
                itemView.setTag(R.id.tag, matchInfo);
                ((TextView) itemView.getChildAt(0)).setText(dataType[currentIndex]);
                ((TextView) itemView.getChildAt(1)).setText(list.get(currentIndex));
                if (matchInfo.isTempCheck(currentIndex)) {
                    itemView.setBackgroundColor(resources.getColor(R.color.primary_highlight));
                    ((TextView) itemView.getChildAt(0)).setTextColor(resources.getColor(R.color.primary_comparison));
                    ((TextView) itemView.getChildAt(1)).setTextColor(resources.getColor(R.color.primary_comparison));
                } else {
                    itemView.setBackgroundColor(resources.getColor(R.color.primary_comparison));
                    ((TextView) itemView.getChildAt(0)).setTextColor(resources.getColor(R.color.text_primary));
                    ((TextView) itemView.getChildAt(1)).setTextColor(resources.getColor(R.color.text_secondary));
                }
                itemView.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        int currentIndex = (int) view.getTag();
                        BallMatchBo.MatchInfo matchInfo = (BallMatchBo.MatchInfo) view.getTag(R.id.tag);
                        matchInfo.setTempCheck(currentIndex, !matchInfo.isTempCheck(currentIndex));
                        LinearLayout itemView = (LinearLayout) view;
                        if (matchInfo.isTempCheck(currentIndex)) {
                            itemView.setBackgroundColor(resources.getColor(R.color.primary_highlight));
                            ((TextView) itemView.getChildAt(0)).setTextColor(resources.getColor(R.color.primary_comparison));
                            ((TextView) itemView.getChildAt(1)).setTextColor(resources.getColor(R.color.primary_comparison));
                        } else {
                            itemView.setBackgroundColor(resources.getColor(R.color.primary_comparison));
                            ((TextView) itemView.getChildAt(0)).setTextColor(resources.getColor(R.color.text_primary));
                            ((TextView) itemView.getChildAt(1)).setTextColor(resources.getColor(R.color.text_secondary));
                        }
                    }
                });
                ++currentIndex;
            }
        }
        return currentIndex;
    }

    private void resetBtnByCurrentBetType(LinearLayout contentView) {
        int count = contentView.getChildCount();
        RadioGroup radioGroup;
        RadioButton btn;
        for (int i = 0; i < count; ++i) {
            radioGroup = (RadioGroup) contentView.getChildAt(i);
            for (int j = 0; j < 3; ++j) {
                int tag = i * 3 + j;
                btn = (RadioButton) radioGroup.getChildAt(j);
                btn.setTag(tag);
                if (mCurrentBetType == 8) {
                    btn.setChecked(tag == 7);
                } else {
                    btn.setChecked(tag == mCurrentBetType);
                }
                btn.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        mCurrentBetType = (int) view.getTag();
                        if (mCurrentBetType == 7) {
                            ll_danguan_top.setVisibility(View.VISIBLE);
                            line_danguan.setVisibility(View.VISIBLE);
                        } else {
                            ll_danguan_top.setVisibility(View.GONE);
                            line_danguan.setVisibility(View.GONE);
                        }
                        mPopupWindow.dismiss();
                        mPopupWindow = null;
                        tv_title.setText(((RadioButton) view).getText());
                        initData();
                    }
                });
            }
        }
    }

    /**
     * 设置添加屏幕的背景透明度
     *
     * @param bgAlpha
     */
    public void backgroundAlpha(float bgAlpha) {
        WindowManager.LayoutParams lp = getWindow().getAttributes();
        lp.alpha = bgAlpha; // 0.0-1.0
        getWindow().setAttributes(lp);
    }

    @Override
    public void showFootballMatchListSuccess(PageData<BallMatchBo> data) {
        if (data == null || data.getSchedules() == null) return;
        mDataList = (ArrayList<BallMatchBo>) data.getSchedules();
        mMatchFilters = null;
        getAdapter().setDatas((List<BallMatchBo>) mDataList.clone(), mCurrentBetType);
        for (int i = 0; i < getAdapter().getGroupCount(); ++i) {
            list_view.expandGroup(i);
        }
    }

    private void resetDanguanData(List<BallMatchBo2> data) {
        if (data == null) return;
        ArrayList<BallMatchBo> list = new ArrayList<>();
        for (BallMatchBo2 bo2 : data) {
            List<List<BallMatchBo.MatchInfo>> matchInfos = (List<List<BallMatchBo.MatchInfo>>) ((ArrayList<List<BallMatchBo.MatchInfo>>) bo2.getList()).clone();
            for (int i = 0; i < matchInfos.size(); ) {
                resetDatas(matchInfos.get(i));
                if (mCurrentBetType == 7) {
                    if (!matchInfos.get(i).get(0).getPlay().getGameType().equals("dg")
                            && !matchInfos.get(i).get(1).getPlay().getGameType().equals("dg")) {
                        matchInfos.remove(i);
                        continue;
                    }
                }
                List<BallMatchBo.MatchInfo> infos = matchInfos.get(i);
                for (BallMatchBo.MatchInfo info : infos) {
                    info.getPlay().setIsCheck(null);
                    info.getPlay().setIsTempCheck(null);
                }
                ++i;
            }
            if (matchInfos.isEmpty()) {
                continue;
            }
            BallMatchBo bo = new BallMatchBo();
            bo.setList1(matchInfos);
            bo.setDate(bo2.getDate());
            list.add(bo);
        }
        mDataList = list;
        mMatchFilters = null;
        getAdapter().setDatas((List<BallMatchBo>) list.clone(), mCurrentBetType);
        for (int i = 0; i < getAdapter().getGroupCount(); ++i) {
            list_view.expandGroup(i);
        }
    }

    private void resetDatas(List<BallMatchBo.MatchInfo> list){
        boolean isHad;
        BallMatchBo.MatchInfo tempInfo=list.get(0);
        for(int i=0;i<5;++i){
            isHad=false;
            for(BallMatchBo.MatchInfo info:list){
                if(info.getType().equals(String.valueOf(i))){
                    isHad=true;
                    break;
                }
            }
            if(!isHad){
                BallMatchBo.MatchInfo matchInfo=new BallMatchBo.MatchInfo();
                matchInfo.setType(String.valueOf(i));
                matchInfo.setPlay(new BallMatchBo.MatchInfo());
                matchInfo.getPlay().setIssue(tempInfo.getPlay().getIssue());
                matchInfo.getPlay().setLid(tempInfo.getPlay().getLid());
                matchInfo.getPlay().setLn2(tempInfo.getPlay().getLn2());
                matchInfo.getPlay().setSaleCloseTime(tempInfo.getPlay().getSaleCloseTime());
                matchInfo.getPlay().setAn(tempInfo.getPlay().getAn());
                matchInfo.getPlay().setAn2(tempInfo.getPlay().getAn2());
                matchInfo.getPlay().setDt(tempInfo.getPlay().getDt());
                matchInfo.getPlay().setGameType("g");
                matchInfo.getPlay().setHand(tempInfo.getPlay().getHand());
                matchInfo.getPlay().setHand2(tempInfo.getPlay().getHand2());
                matchInfo.getPlay().setHn(tempInfo.getPlay().getHn());
                matchInfo.getPlay().setHn2(tempInfo.getPlay().getHn2());
                matchInfo.getPlay().setId(tempInfo.getPlay().getId());
                matchInfo.getPlay().setOt(tempInfo.getPlay().getOt());
                matchInfo.getPlay().setNo(tempInfo.getPlay().getNo());
                matchInfo.getPlay().setSpTypeDg(new ArrayList<>());
                matchInfo.getPlay().setSpTypeGg(new ArrayList<>());
                list.add(i,matchInfo);
            }
        }

    }

    @Override
    public void showFootballMatchListSuccess2(PageData<BallMatchBo2> data) {
        if (data == null || data.getSchedules() == null) return;
        if (mCurrentBetType == 6) {
            resetDanguanData(data.getSchedules());
        } else {
            mDanguanData = (ArrayList<BallMatchBo2>) data.getSchedules();
            resetDanguanData((ArrayList<BallMatchBo2>) mDanguanData.clone());
        }
    }


    @Override
    public void showFootballMatchListError(String error) {
        T.showShort(error);
    }

    @Override
    public void showSFCMatchSuccess(BallMatchBo matchBo) {

    }
}
